package com.zxy.demo.java;

import org.springframework.beans.BeanUtils;

/**
 * BeanUtilsDemo.
 * 
 * Created by zxybird on 17/1/24.
 */
public class BeanUtilsDemo {

  // BeanUtils
  // BeanUtils
  // PropertyUtils

  // BeanUtils.copyProperties();

  // org.springframework.beans.BeanUtils.

  public static void main(String[] args) {

    // DO do = new DO();
    DO do1 = new DO();
    DTO dto = new DTO();

    do1.setAge(12);
    do1.setName("zxy");

    BeanUtils.copyProperties(do1, dto);

    System.out.println(dto.getName());
    System.out.println(dto.getAge());
  }

}

class MyBeanUtils extends BeanUtils {

}

class DO {
  private int age;

  private String name;

  public int getAge() {
    return age;
  }

  public void setAge(int age) {
    this.age = age;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }
}

class DTO {

  private String name;

  private int age;

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public int getAge() {
    return age;
  }

  public void setAge(int age) {
    this.age = age;
  }
}